// *************************************************************************************************
//
// MK3D Engine
// --------------------------------------
// Copyright (C) 2007-2011 Zeb (mailto: zebbey@gmail.com)
//
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//
// *************************************************************************************************

#ifndef __H_MK_VIEW_FRUSTUM__
#define __H_MK_VIEW_FRUSTUM__

#include "mk_aabb.h"

namespace MK3DE
{
	enum VIEW_FRUSTUM_PLANE
	{
		VFP_LEFT = 0,
		VFP_RIGHT = 1,
		VFP_TOP = 2,
		VFP_BOTTOM = 3,
		VFP_NEAR = 4,
		VFP_FAR = 5,
		VFP_MAX = 6,
	};

	class MK3DE_API CViewFrustum
	{
	public:
		void ExtractViewFrustum(D3DXMATRIX& viewProj);
		BOOL TestFrustumAABB(AABB& aabb);

		void AddCustomPlane(D3DXPLANE& plane) { _vecCustomPlane.push_back(plane); }
		void ClearAllCustomPlane() { _vecCustomPlane.clear(); }

	private:
		D3DXPLANE _viewFrustumPlane[VFP_MAX];
		std::vector<D3DXPLANE>  _vecCustomPlane;
	};
};

#endif // __H_MK_VIEW_FRUSTUM__